import React, { PureComponent } from "react"
import Cart from "./pages/Cart"

export class App extends PureComponent {
    constructor() {
        super()
        this.state = {
            isLogin: false,
        }
    }

    handleLogin() {
        localStorage.setItem("token", "waibiwaibi")
        this.setState({
            isLogin: true,
        })

        //强制刷新
        // this.forceUpdate() 
    }

    render() {
        return (
            <div>
                <button onClick={() => this.handleLogin()}>登录</button>
                <Cart />
            </div>
        )
    }
}

export default App
